/******************************************************************************

 ******************************************************************************
  File Name	:ftp.h
  Version		:001
  Author		:liangH
  Description	:define ftp class for file transmission
  History		:20130222 new
  Modification	: 

******************************************************************************/

#ifndef __FTP_H__
#define __FTP_H__

#include "config.h"

typedef struct tag_FTP_Config
{
	struct sockaddr_in s_in;
	FILE *control_stream;
}FTP_Config;

class FTP
{
	/*variable*/
	private: 
		pthread_mutex_t read_write_lock;/*read and write lock*/
		int tcp_socket;
		FTP_Config *ftp;
	/*constructed function and deconstructed function*/
	public:
		FTP();/*constructed function*/
		~FTP();/*deconstructed function*/
		
	public:
	/*set,get member functin*/

	/*set,get member functin end*/

	/*basic function*/
		int ftp_get_filesize(char file_type, char *file_name, unsigned long *filesize);
	/*basic function end*/
	
	private:	
	/*inside process function*/
		int ftp_initialize(FTP_Config **sftp);
		int ftp_release(FTP_Config *sftp);
		int ftp_connect(FTP_Config *sftp, char *user, char *pass, char *host, int port);
		void ftp_disconnect(FTP_Config *sftp );
		int ftpcmd(FTP_Config *sftp, const char *s1, const char *s2, FILE *stream, char *buf);
		int xconnect(const struct sockaddr_in *s_addr);
		int cwd(FTP_Config *sftp, char *dir);
		char *pwd(FTP_Config *sftp);
		int safe_strtoul(char *arg, unsigned long* value);
	/*inside process function end*/	
 };

#endif

